home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
sos3-2.lha
/
src
/
agg
/
Aggregate_scp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-23
|
3KB
|
101 lines
#line 1 "/fzi/prost/stone/SOS3-2/src/agg/Aggregate.c"
/* --------------------------------------------------------------------------
* Copyright 1992 by Forschungszentrum Informatik (FZI)
*
* You can use and distribute this software under the terms of the licence
* you should have received along with this program.
* If not or if you want additional information, write to
* Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
* D-7500 Karlsruhe 1, Germany.
* --------------------------------------------------------------------------
*/
// **************************************************************************
// Module Aggregate 30/08/89 Bernhard Schiefer (bs)
//
// **************************************************************************
// implements methods of classes: sos_Aggregate, sos_Cursor
// **************************************************************************
#include "sys.h"
#include "agg_err.h"
#include "trc_agg.h"
#include "agg_sos.h"
// **************************************************************************
sos_Bool agg_same_entity (sos_Object o1, sos_Object o2,
sos_Bool based_on_equal, sos_Eq_kind eq_kind)
// **************************************************************************
{ if (based_on_equal)
return o1.equal(o2, eq_kind);
else
return o1.identical(o2);
}
// **************************************************************************
sos_Bool _sos_Aggregate::is_empty (sos_Typed_id &_tpid)
// **************************************************************************
{
T_PROC ("sos_Aggregate::is_empty");
TT (agg_H, T_ENTER);
sos_Bool result = (sos_Bool)(sos_Aggregate::make(_tpid,this).card() == 0);
TT (agg_H, T_LEAVE; TI (result));
return result;
} // ** is_empty **
// **************************************************************************
void _sos_Aggregate::clear (sos_Typed_id &_tpid)
// **************************************************************************
{
T_PROC ("Aggregate::clear");
TT (agg_H, T_ENTER);
sos_Cursor c = sos_Aggregate::make(_tpid,this).open_cursor ();
for ( ;
sos_Aggregate::make(_tpid,this).is_valid (c);
sos_Aggregate::make(_tpid,this).remove_at (c) ) ; // no body
sos_Aggregate::make(_tpid,this).close_cursor (c);
TT (agg_H, T_LEAVE);
} // ** clear **
// ******************************* sos_Cursor ***************************
// **************************************************************************
void _sos_Cursor::local_initialize (sos_Cursor c)
// **************************************************************************
{
T_PROC ("sos_Cursor::local_initialize");
TT (agg_H, T_ENTER);
c.set_current (sos_Node::make (NO_OBJECT));
TT (agg_H, T_LEAVE);
} // ** local_initialize **
// **************************************************************************
sos_Bool _sos_Cursor::defined_for (sos_Typed_id &_tpid,sos_Aggregate agg)
// **************************************************************************
{
T_PROC ("sos_Cursor::defined_for");
TT (agg_H, T_ENTER);
#ifdef ATT
sos_Bool result = (sos_Bool)(agg.operator==(sos_Cursor::make(_tpid,this).get_domain()));
#else
sos_Bool result = (sos_Bool)(agg == sos_Cursor::make(_tpid,this).get_domain());
#endif
TT (agg_H, T_LEAVE);
return result;
} // ** defined_for **